/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.visualjavafxgui.editor.visual.widgets;

import java.awt.BasicStroke;
import java.awt.Graphics2D;
import org.netbeans.api.visual.widget.Scene;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Rectangle;

/**
 *
 * @author psychollek
 */
public class RectangleWidget extends ShapeWidget {

    private Rectangle rect;

    public RectangleWidget(Scene scene, Rectangle rect){
        super(scene,rect);
        this.rect = rect;
    }

    @Override
    protected void paintWidget(){
        Graphics2D g = getGraphics ();
        int width = (new Double(rect.getSizeH())).intValue();
        int heigh = (new Double(rect.getSizeV())).intValue();
        g.setColor(rect.getFillColor());
        g.fillRect(0,0, width, heigh);
        g.setColor (rect.getBorderColor());
        BasicStroke stroke = new BasicStroke(new Float(rect.getBorderWidth()));
        g.setStroke(stroke);
        g.drawRect(0,0,width,heigh);
    }

}
